package com.example.javafx.路径;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.stage.Stage;

/**
 * 创建路径
 */
public class Main extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        Scene scene = new Scene(new Group());

        primaryStage.setTitle("Checkbox Sample");
        primaryStage.setWidth(230);
        primaryStage.setHeight(120);

        Path path = new Path();
        path.getElements().add(new MoveTo(0.0f,50.0f));
        path.getElements().add(new LineTo(100.0f,100.0f));

        VBox box = new VBox();
        box.getChildren().add(path);
        box.setSpacing(5);

        HBox root = new HBox();
        root.getChildren().add(box);
        root.setSpacing(40);
        root.setPadding(new Insets(20,10,10,20));
        ((Group)scene.getRoot()).getChildren().add(root);
        primaryStage.setScene(scene);
        primaryStage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }
}
